The present disclosure relates to compressing and decompressing image data. Some aspects relate in particular to the compression and decompression of colour data associated with blocks of one or more pixels and/or texels of the type that may be used as part of computer graphics systems.
There are many circumstances where it may be desirable to compress image data in order to reduce the amount of required storage, or memory, space. Computer graphics is one field where it may be desirable to reduce the amount of storage for image data. In computer graphics systems, each colour (e.g. the colour of a pixel, or block of one or more pixels) may comprise one or more components, e.g. red, green and blue (known collectively as RGB) and alpha (α), where alpha represents a transparency or blending component used when a colour is to be overlaid on an existing colour. Other colour components may also be specified such as YUV (where Y represents luma and U and V each represent chrominance components). Each stored colour may use a number of bits (e.g. 8 bits) for each colour component. The number of bits per colour component can be increased or decreased for greater or lesser colour resolution.
One approach to compress colour data for an image is to encode the data for that image in some way so that the encoding is stored rather than the complete set of colour values for the image. One way to encode the colour data is to use vector quantisation. Vector quantization is generally directed to the idea of representing an input value space (e.g. a colour space) as a discrete output space. In practice, the input space is likely to also be discretised, but at a finer resolution than the output space. The vectors that represent this discretised output space may be referred to as codevectors, or codewords. The set of codevectors may be stored in a codebook that may be index-referenced. Although vector quantization can be used to represent a colour space well, the codebook can in certain circumstances become very large, limiting the effectiveness of vector quantization as a way of compressing image data.
Another approach to encode colour data for an image is to apply a colour-space conversion. Here, a colour space spanned by the image data may be converted to a different colour space. One example of a colour space conversion is the conversion from RGB space to YUV space, for example YCbCr, where Y represents the luma, Cb represents the blue component minus the luma, and Cr represents the red component minus the luma. The converted space is typically assumed to be an N-dimensional rectangular prism (with the number of dimensions N being equal to the number of colour components). However a problem with this approach is that certain encodings may produce values that are outside of the range of the space once those encodings have been converted.